export const BoneCommonMixin = {
  filters: {
    ifNull: function (text) {
      return text == null || text === undefined ? "" : text;
    },
    parseTimestamp: function (time) {
      if (time == null) {
        return new Date().getTime();
      }
      return new Date(time).getTime();
    },
  },
  methods: {
    showInfo: function (description) {
      this.$notification.open({
        message: '提示信息',
        duration: 3,
        description: description,
        icon: h => <a-icon type="smile" style="color: #108ee9"/>
      });
    },
    showError: function (description) {
      this.$notification.error({message: "提示信息", description: description, duration: 2});
    },
    showWarn: function (description) {
      this.$notification.warn({message: "提示信息", description: description, duration: 2});
    },
    showSuccess: function (description) {
      this.$notification.success({message: "提示信息", description: description, duration: 2});
    },
    toArrayComma: function (text) {
      if (text == null || text === undefined) {
        return [];
      } else {
        return text.split(",");
      }
    },
  },
};